# -*- coding: UTF-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import pylab as pl
# Pa 轴功率
Q = np.array([0.0,199.6,322.4,421.3,522.4,573.3,622.8,672.0,716.7,733.9,791.6,890.9,980.3])
Pa = np.array([133.86,185.33,218.08,249.18,282.56,298.04,315.25,331.08,344.46,349.81,367.13,396.67,423.18])
yita = np.array( [0.0,45.4,62.3,71.3,76.9,78.7,79.6,80.3,81.1,81.1,81.5,80.5,78.1])

func = np.polyfit(Q,yita,3)
pl = np.poly1d(func)

_x = np.arange(0,1000)

plt.plot(Q,yita,'ro')
plt.plot(_x,pl(_x),'b')
plt.ylim(ymax=100,ymin=0)
print func
print pl
plt.title("y = {} + {}x + {}$x^2 + {}$x^3$".format(pl[3],pl[2],pl[1],pl[0]))
#plt.title("y = {} + {}x + {}$x^2$".format(pl[2],pl[1],pl[0]))
plt.annotate('yita-Q', xy=(716.7,81.1), xytext=(800, 60), arrowprops=dict(facecolor='black', shrink=0.05))
plt.show()